var app = getApp();

Page({
    data: {
        _is_load: !0,
        is_akey: !1
    },
    onLoad: function() {
        var t = this;
        app.util.footer(this), app.util.getUserInfo(function(a) {
            t.setData({
                userInfo: a
            });
        }), app.util.request({
            url: "entry/wxapp/Setupa",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                t.setData({
                    setup: a.data.data
                });
            }
        }), app.util.request({
            url: "entry/wxapp/MailSetup",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                t.setData({
                    mailsetup: a.data.data
                });
            }
        }), app.util.request({
            url: "entry/wxapp/GetCard",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                0 == a.data.errno && (a.data.data ? t.setData({
                    card_info: a.data.data,
                    _is_load: !1
                }) : (wx.showModal({
                    title: "提示",
                    content: "你还没有创建名片",
                    confirmText: "创建名片",
                    success: function(a) {
                        a.confirm ? wx.navigateTo({
                            url: "../../card/edit/card-edit"
                        }) : a.cancel && t.setData({
                            _is_load: !1,
                            no_card: !0
                        });
                    }
                }), t.setData({
                    _is_load: !1,
                    no_card: !0
                })));
            }
        }), t.data.userInfo.memberInfo || wx.showModal({
            title: "重要提示",
            content: "你【拒绝】了授权，不能和您一起快乐的玩耍了！请10分钟后再次点击授权，或者删除小程序重新进入，点击【允许】",
            showCancel: !1,
            success: function(a) {
                wx.navigateBack({
                    delta: 3
                });
            }
        }), t.data.setup.sysopenid != card_info.openid && wx.showModal({
            title: "重要提示",
            content: "非法进入！你不是管理员",
            showCancel: !1,
            success: function(a) {
                wx.navigateBack({
                    delta: 3
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    mails_admin: function(a) {
        wx.navigateTo({
            url: "../../card/mailad/mailad"
        });
    },
    newsaudit: function(a) {
        wx.navigateTo({
            url: "../../examine/newsaudit/newsaudit"
        });
    },
    gunaudit: function(a) {
        wx.navigateTo({
            url: "../../examine/gunaudit/gunaudit"
        });
    },
    cradaudit: function(a) {
        wx.navigateTo({
            url: "../../examine/cradaudit/cradaudit"
        });
    }
});